class GasModel {
  List<GasMonitoring>? envtal;

  GasModel({this.envtal});

  GasModel.fromJson(Map<String, dynamic> json) {
    if (json['envtal'] != null) {
      envtal = <GasMonitoring>[];
      json['envtal'].forEach((v) {
        envtal!.add(new GasMonitoring.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.envtal != null) {
      data['envtal'] = this.envtal!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class GasMonitoring {
  String? deviceCode;
  String? deviceName;
  DateTime? portalAt;
  int? baseTypeId;
  List<Gass>? gass;

  GasMonitoring({
    this.deviceCode,
    this.deviceName,
    this.portalAt,
    this.baseTypeId,
    this.gass,
  });

  GasMonitoring.fromJson(Map<String, dynamic> json) {
    deviceCode = json['deviceCode'];
    deviceName = json['deviceName'];
    portalAt = json['portalAt'] !=null ?DateTime.tryParse(json['portalAt']):null;
    baseTypeId = json['baseTypeId'];
    if (json['gass'] != null) {
      gass = <Gass>[];
      json['gass'].forEach((v) {
        gass!.add(new Gass.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['deviceCode'] = this.deviceCode;
    data['deviceName'] = this.deviceName;
    data['portalAt'] = this.portalAt;
    data['baseTypeId'] = this.baseTypeId;
    if (this.gass != null) {
      data['gass'] = this.gass!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Gass {
  String? code;
  String? name;
  String? val;
  DateTime? portalAt;

  Gass({this.code, this.name, this.val, this.portalAt});

  Gass.fromJson(Map<String, dynamic> json) {
    code = json['code'];
    name = json['name'];
    val = json['val'];
    portalAt = json['portalAt'] !=null ?DateTime.tryParse(json['portalAt']):null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['code'] = this.code;
    data['name'] = this.name;
    data['val'] = this.val;
    data['portalAt'] = this.portalAt;
    return data;
  }
}
